dirPath=$1
fileName=$2
packageName=$3
filePath="${dirPath}/${fileName}.apk"
unBuildDir="${dirPath}/${fileName}"
newApkFilePath="${dirPath}/逆向-${fileName}.apk"

cd $dirPath
echo ------------------------------反编译中...---------------------;
apktool d $filePath

echo ------------------------------修改中---------------------;
echo ------------------------------修改包名---------------------;
sed -i "s#package=\"[^\"]*\"#package=\"$packageName\"#" "${unBuildDir}/AndroidManifest.xml"

echo ------------------------------重新打包---------------------;
apktool b $unBuildDir -o $newApkFilePath

echo ------------------------------逆向结束---------------------;